package com.jingfu.util;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONObject;
import lombok.Data;

import java.util.ArrayList;

/**
 * @author jingfuu@163.com
 * @version v1.0
 * @date 2022/1/24 上午10:54
 **/
@Data
public class PageResult<T> extends CommonResult {
    //数据总条数
    private long count;

    public PageResult(Builder builder, long count) {
        super(builder);
        this.count = count;
    }

    public static <T> PageResult<T> page(T body, long count) {
        Builder builder = ok().data(body);
        return new PageResult<>(builder,count);
    }

    public static void main(String[] args) {
        PageResult<ArrayList<String>> page = PageResult.page(CollUtil.newArrayList("1", "2"), 2);
        System.out.println(page);
    }
}
